﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.ContourBuilder.Components;
using ITAP.ContourBuilder.Utils;

namespace ITAP.ContourBuilder.Operations
{
    public class OperationGetOffsetContour : Operation
    {
        public override void Execute()
        {
            List<IContourComponent> newModels = new List<IContourComponent>();
            foreach (IContourComponent component in Control.ContourContainer.InnerComponents)
            {
                ContourModel newModel = null;
                newModel = ContourUtils.GetOffsetModel(component as ContourModel, true);
                newModels.Add(newModel);
            }

            foreach (IContourComponent model in newModels)
                Control.ContourContainer.AddInnerComponent(model);

            this.Exit();
        }

        public override bool CanUndo
        {
            get
            {
                return true;
            }
        }
    }
}
